import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const adminStore = new Vuex.Store(
  {
    state: {
      isShowASider: true,
      isCollapseASider: false,
      aSiderItems: [],
      logoName: "商品库",
      currentUser: {},
      webInfo: {},
      errorMessage: null
    },
    mutations: {
      errorMessage(state, message) {
        state.errorMessage = message;
      },
      setSiderItems(state, itmes) {
        state.aSiderItems = itmes;
      },
      webInfo(state, webinfo) {
        state.webInfo = webinfo;
      },
      showASider(state) {
        state.isShowASider = true;
      },
      hideASider(state) {
        state.isShowASider = false;
      },
      toggerASider(state) {
        state.isShowASider = !state.isShowASider;
      },
      collapseASider(state) {
        state.isCollapseASider = true;
      },
      notCollapseASider(state) {
        state.isCollapseASider = false;
      },
      toggerCollapseASider(state) {
        state.isCollapseASider = !state.isCollapseASider;
      },
      currentUser(state, user) {
        state.currentUser = user;
      }
    }
  }
);


export default adminStore;
